/*
 * @Author: underMoonzs 1994186472@qq.com
 * @Date: 2025-10-05 21:41:58
 * @LastEditors: underMoonzs 1994186472@qq.com
 * @LastEditTime: 2025-10-06 15:29:45
 * @FilePath: \environment-map-app\src\main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
// 引入Vant UI组件库
import Vant from "vant";
// 引入Vant UI样式
import "vant/lib/index.css";
// 引入mitt
import mitt from 'mitt';

import { setToken } from "./utils/auth";
const app = createApp(App);

// 创建mitt实例作为全局事件总线
const emitter = mitt();
// 添加到全局属性中，使其在所有组件中可用
app.config.globalProperties.$emitter = emitter;
// 同时提供给组合式API使用
app.provide('emitter', emitter);

const getTkFromUrl = () => {
  const urlParams = new URLSearchParams(window.location.search);
  const tk = urlParams.get("tk");
  setToken(tk);
};
getTkFromUrl();

// 全局注册Vant组件
app.use(Vant);

app.mount("#app");
